import { exportExcel, request } from './request';
export{
    Init,//主页初始化
  GetCourse,//获取课程信息
  curriculumInit,//初始化课程表
  login,//登录注册
  bindAdmin,//绑定管理员账号
  GetActivity,//获取管理员活动列表
  GetActivityDetail,//活动详情
  GetGradeActivity,
  activityExportJoin,//导出报名名单
  activityExportSign,
  addActivity,//管理员添加活动
  GetSignDetail,//获取签到详情
  JoinActivity,//参与活动
  CancelJoin,//取消参与
  GetStudentData,//获取参与学生信息
  getGradeClasses,//获取 年级与其班级
  updateUserInfo,//绑定学生信息
  updateAdminInfo,//管理员账号登陆
  SignIn,//签到
  uploadJoin,//学生自主申报
  GetJoinActivity,//获取学生参与的活动
  AddLook,//学生处理活动
  GetSignHistory,//获取签到记录
  GetNotice,//获取通知列表
  addNotice,//管理员发布通知
  AddNoticeLook,//学生处理通知
  getAllClass,//获取所有年纪与其包含的班级
  getAllRole,//获取所有职务
  DeleteFile,//删除无用文件
  mergeSeparation,//合并被分开的课程数据
  getFail,//获取不通过活动
  updateActivity,//修改活动
  //请假
  leavePreview,
  leaveNew,
  leaveHistory,
  //请假结束
  ChangeSrInfo,//课代表修改签到详情
  getDutyCourseInfo,//课代表修改签到详情-获取可修改的信息
  getDutyCourseDetail,
  getCourseInfoAdmin,//管理员获取所有可签到的信息
  editSrInfo,//修改签到信息
  dailySign,//
  dailySignDetail,
  judgeLeave,//辅导员查看请假信息
  judgeLeaveSave,//辅导员审核请假信息
  weeklyAbsent,//
  weeklyAbsentPre,//
  weeklyAbsentExport,
  //导出签到信息
  exportExcelOne,//一次课导出
  ExportExcelAll,//一门课所有上过的课一起导出
  CourseAnalysis,
  AnalysisExportStudent,
  AnalysisS,
  AnalysisSExport,
  //
  ExportStudents,
  GetStudents,
  setHoliday,
  getDutyCourseDetail2,
}
const Init = (data: {code:string}) => {
    return request({
      url: 'init',
      method: 'GET',
      data: data,
    })
  }
/**
 * @function 获取课程信息
 */
const GetCourse = (data: {code:string}) => {
  return request({
    url: 'GetCourse',
    method: 'GET',
    data: data,
  })
}
//
const curriculumInit = (data: {code:string}) => {
  return request({
    url: 'curriculumInit',
    method: 'GET',
    data: data,
  })
}
const login = (data:{code:string})=>{
  return request({
    url: 'Login',
    method: 'GET',
    data: data,
  })
}
const bindAdmin = (data:{name:string,code:string,wx_code:string})=>{
  return request({
    url: 'BindAdmin',
    method: 'GET',
    data: data,
  })
}
//getGradeClasses
const getGradeClasses = ():any=>{
  return request({
    url: 'getGradeClasses',
    method: 'GET',
    data: {},
  })
}
//学生用户绑定信息
const updateUserInfo = (data:{code:string,class_id:number,userId:number,openid:string}):any=>{
  return request({
    url: 'updateUserInfo',
    method: 'GET',
    data: data,
  })
}
//
const updateAdminInfo = (data:{account:string,password:string,openid:string}):any=>{
  return request({
    url: 'updateAdminInfo',
    method: 'GET',
    data: data,
  })
}
//GetSignDetail
const GetSignDetail= (data:{other_id:string | number,other_type:string}):any=>{
  return request({
    url: 'GetSignDetail',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 签到
 */
const SignIn=(data:{sr_id:number, name:string ,code:string ,week:number | '',type:'正常签到' | '迟到',s_type:'课程'|'活动'}):any=>{
  return request({
    url: 'SignIn',
    method: 'GET',
    data: data,
  })
}
/**
 * @function 获取活动列表
 */
const GetActivity = (data:{s_code:string})=>{
  return request({
    url: 'GetActivity',
    method: 'GET',
    data: data,
  })
}
//GetActivityDetail
const GetActivityDetail = (data:{s_code:string,a_id:string|number})=>{
    return request({
      url: 'GetActivityDetail',
      method: 'GET',
      data: data,
    })
  }
/**
 * @function 管理员添加活动
 */
const addActivity = (data:{title:string,place:string,start_time:string,end_time:string,people:string,content:string,grade:string,classes:string,need:number,limit:number,lat:number,lon:number}):any=>{
  return request({
    url: 'addActivity',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 参加活动
 */
const JoinActivity = (data:{a_id:number,s_code:string}):any=>{
  return request({
    url: 'JoinActivity',
    method: 'GET',
    data: data,
  })
}
/**
 * @function 获取全年级的已发布活动
 */
const GetGradeActivity = (data:{openid:string}):any=>{
    return request({
      url: 'GetGradeActivity',
      method: 'GET',
      data: data,
    })
  }
/**
 * @function 取消参加
 */
const CancelJoin = (data:{s_code:string,a_id:number}):any=>{
  return request({
    url: 'CancelJoin',
    method: 'GET',
    data: data,
  })
}


/**
 * @function 获取参与学生信息
 */
const GetStudentData = (data:{a_id:number}):any=>{
  return request({
    url: 'GetStudentData',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 学生自主申报
 */
const uploadJoin = (data:{title:string,place:string,start_time:string,end_time:string,people:string,s_name:string,s_code:string,prize:string}):any=>{
  return request({
    url: 'uploadJoin',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 获取学生参与的活动
 */
const GetJoinActivity = (data:{s_code:string}):any=>{
  return request({
    url: 'GetJoinActivity',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 学生处理活动
 */
const AddLook = (data:{a_id:number,s_code:string}):any=>{
  return request({
    url: 'AddLook',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 获取签到记录
 */
const GetSignHistory = (data:{name:string,code:string}):any=>{
  return request({
    url: 'GetSignHistory',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 获取通知列表
 */
const GetNotice = (data:{class_id:number,s_code:string})=>{
  return request({
    url: 'GetNotice',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 管理员发布通知
 */
const addNotice = (data:{title:string,time:string,people:string,content:string,grade:string,classes:string}):any=>{
  return request({
    url: 'addNotice',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 学生处理通知
 */
const AddNoticeLook = (data:{n_id:number,s_code:string}):any=>{
  return request({
    url: 'AddNoticeLook',
    method: 'GET',
    data: data,
  })
}
/**
 * @function 获取所有年级与其包含的班级
 */
const getAllClass = ():any=>{
  return request({
    url: 'getAllClass',
    method: 'GET',
    data: {},
  })
}

/**
 * @function 获取所有职务
 */
const getAllRole = ():any=>{
  return request({
    url: 'getAllRole',
    method: 'GET',
    data: {},
  })
}

/**
 * @function 获取不通过活动
 */
const getFail = ():any=>{
  return request({
    url: 'getFail',
    method: 'GET',
    data: {},
  })
}

/**
 * @function 修改活动
 */
const updateActivity = (data:{a_id:number,title:string,people:string,place:string,start_time:string,end_time:string,content:string,limit:number}):any=>{
  return request({
    url: 'updateActivity',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 删除无用文件
 */
const DeleteFile = (data:{file_path:string})=>{
  return request({
    url: 'DeleteFile',
    method: 'GET',
    data: data,
  })
}
const mergeSeparation=(data:{c_id1:string | number,c_id2:string | number})=>{
  return request({
    url: 'mergeSeparation',
    method: 'GET',
    data: data,
  })
}
//请假接口
/**
 * @function 预览请假的课程
 */
const leavePreview=(data:{start:string ,start_time:string ,end:string ,end_time:string,s_code:string})=>{
  return request({
    url: 'leavePreview',
    method: 'GET',
    data: data,
  })
}
/**
 * @function 创建请假申请
 */
const leaveNew=(data:{start:string ,start_time:string ,end:string ,end_time:string,reason:string,s_code:string,sr_leave:string})=>{
  return request({
    url: 'leaveNew',
    method: 'GET',
    data: data,
  })
}
/**
 * @function 查看请假历史
 */
const leaveHistory=(data:{s_code:string})=>{
  return request({
    url: 'leaveHistory',
    method: 'GET',
    data: data,
  })
}

/**
 * @function 课代表修改签到详情 后端会二次验证用户权限 //todo 上传凭证
 */
const ChangeSrInfo=(data:{sr_id:number,openid:string,reason:string,change:string})=>{
  return request({
    url: 'ChangeSrInfo',
    method: 'GET',
    data: data,
  })
}
//
const getDutyCourseDetail=(data:{course_id:number | string,openid:string})=>{
  return request({
    url: 'getDutyCourseDetail',
    method: 'GET',
    data: data,
  })
}
const getDutyCourseDetail2=(data:{course_id:number ,c_day:number,c_time:string,week:number,openid:string})=>{
  return request({
    url: 'getDutyCourseDetail2',
    method: 'GET',
    data: data,
  })
}
/**
 * @function 课代表修改签到详情-获取可修改的信息 后端会二次验证用户权限
 */
const getDutyCourseInfo=(data:{s_code:string})=>{
  return request({
    url: 'getDutyCourseInfo',
    method: 'GET',
    data: data,
  })
}
/**
 * @function 辅导员与后台管理员修改签到详情-获取所有课程的信息 后端会二次验证用户权限
 */
const getCourseInfoAdmin=(data:{openid: string})=>{
  return request({
    url: 'getCourseInfoAdmin',
    method: 'GET',
    data: data,
  })
}
//editCourse
const editSrInfo=(data:{signDetail:string,sr_id:string,openid:string,editAll:number})=>{
  return request({
    url: 'editSrInfo',
    method: 'GET',
    data: data,
  })
}
//dailySign
const dailySign=(data:{nowDay:string,grade:string})=>{
  return request({
    url: 'dailySign',
    method: 'GET',
    data: data,
  })
}
//judgeLeave
//小程序获取请假信息
const judgeLeave=(data:{})=>{
  return request({
    url: 'judgeLeave',
    method: 'GET',
    data: data,
  })
}
//judgeLeaveSave
const judgeLeaveSave=(data:{flag:number,leave_id:number,judgeNote:string,openid:string})=>{
  return request({
    url: 'judgeLeaveSave',
    method: 'GET',
    data: data,
  })
}
const ExportExcelAll=(param:{data:{course_id:number},fileName:string})=>{
  return exportExcel({
    url: 'ExportExcelAll',
    method: 'GET',
    data: param.data,
    fileName:param.fileName,
  })
}
const exportExcelOne=(param:{data:{course_id:number,week:string|number,day:string|number,time:string},fileName:string})=>{
  return exportExcel({
    url: 'ExportExcelOne',
    method: 'GET',
    data: param.data,
    fileName:param.fileName,
  })
}
//dailySignDetail
const dailySignDetail=(data:{course_id:number |string,date:string})=>{
  return request({
    url: 'dailySignDetail',
    method: 'GET',
    data: data,
  })
}
//获取缺勤名单
//weeklyAbsent
const weeklyAbsent=(data:{openid:string,week:number,page:number})=>{
  return request({
    url: 'weeklyAbsent',
    method: 'GET',
    data: data,
  })
}
//weeklyAbsentPre
const weeklyAbsentPre=(data:{openid:string})=>{
  return request({
    url: 'weeklyAbsentPre',
    method: 'GET',
    data: data,
  })
}
//weeklyAbsentExport
const weeklyAbsentExport=(param:{data:{openid:string,week:number},fileName:string})=>{
  return exportExcel({
    url: 'weeklyAbsentExport',
    method: 'GET',
    data: param.data,
    fileName:param.fileName,
  })
}
//weeklyAbsentExport
const activityExportJoin=(param:{data:{openid:string,a_id:number},fileName:string})=>{
    return exportExcel({
      url: 'activityExportJoin',
      method: 'GET',
      data: param.data,
      fileName:param.fileName,
    })
}
const activityExportSign=(param:{data:{openid:string,a_id:number},fileName:string})=>{
    return exportExcel({
      url: 'activityExportSign',
      method: 'GET',
      data: param.data,
      fileName:param.fileName,
    })
  }
//CourseAnalysis
const CourseAnalysis=(data:{course_id:number,openid:string})=>{
    return request({
      url: 'CourseAnalysis',
      method: 'GET',
      data: data,
    })
}
//AnalysisS
const AnalysisS=(data:{s_code:string})=>{
    return request({
      url: 'AnalysisS',
      method: 'GET',
      data: data,
    })
}
const AnalysisExportStudent=(param:{data:{course_id:number},fileName:string})=>{
    return exportExcel({
      url: 'AnalysisExportStudent',
      method: 'GET',
      data: param.data,
      fileName:param.fileName,
    })
  }
//AnalysisSExport
const AnalysisSExport=(param:{data:{s_code:string},fileName:string})=>{
    return exportExcel({
      url: 'AnalysisSExport',
      method: 'GET',
      data: param.data,
      fileName:param.fileName,
    })
  }
//ExportStudents
const ExportStudents=(param:{data:{openid:string,c_type:'主修课程'|'通识选修课'|'',className:string,course_id:number,week:number},fileName:string})=>{
    return exportExcel({
      url: 'ExportStudents',
      method: 'GET',
      data: param.data,
      fileName:param.fileName,
    })
}
//GetStudents
const GetStudents=(data:{openid:string,className:string})=>{
    return request({
      url: 'GetStudents',
      method: 'GET',
      data: data,
    })
}
//setHoliday
const setHoliday=(data:{signDetail:string,openid:string})=>{
  return request({
    url: 'setHoliday',
    method: 'GET',
    data: data,
  })
}
